import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import Download from '../views/Download.vue'
import History from '../views/History.vue'
import Preview from '../views/Preview.vue'
import FileExplorer from '../views/FileExplorer.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { 
      title: '首页',
      icon: 'HomeFilled'
    }
  },
  {
    path: '/download',
    name: 'Download',
    component: Download,
    meta: { 
      title: '内容下载',
      icon: 'Download'
    }
  },
  {
    path: '/history',
    name: 'History',
    component: History,
    meta: { 
      title: '下载历史',
      icon: 'List'
    }
  },
  {
    path: '/preview',
    name: 'Preview',
    component: Preview,
    meta: {
      title: '文件预览',
      icon: 'Document'
    }
  },
  {
    path: '/file-explorer',
    name: 'FileExplorer',
    component: FileExplorer,
    meta: {
      title: '文件浏览器',
      icon: 'Document'
    }
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

// 添加路由守卫日志
router.beforeEach((to, from, next) => {
  console.log('Navigating to:', to.path)  // 添加日志
  next()
})

export default router; 